package com.wantong.jianpu.viewmodels;

import android.app.Application;
import android.os.Bundle;

import androidx.annotation.NonNull;

import com.wantong.jianpu.activitys.TourSignActivity;
import com.wantong.jianpu.adapters.DetailImageAdapter;
import com.wantong.jianpu.adapters.TourDetailImageAdapter;
import com.wantong.jianpu.beans.InspectionDetailBean;
import com.wantong.jianpu.utils.Constants;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;
import me.goldze.mvvmhabit.bus.event.SingleLiveEvent;

/**
 * @author PACY
 * @date 2022/5/7
 * description:
 */
public class TourChildDetailViewModel extends BaseViewModel {
    public TourDetailImageAdapter mAdapter;
    public String id;
    public SingleLiveEvent<InspectionDetailBean.RecordListDTO> data = new SingleLiveEvent<>();
    public TourChildDetailViewModel(@NonNull Application application) {
        super(application);
    }

    @Override
    protected void init() {
        super.init();
        initAdapter();
    }

    private void initAdapter(){
        mAdapter=new TourDetailImageAdapter();
        if(data.getValue().getImageList()!=null){
            mAdapter.setNewInstance(data.getValue().getImageList());
        }
    }

    /**
     * 签字提交
     */
    public BindingCommand toSignPage=new BindingCommand(() -> {
        Bundle bundle=new Bundle();
        bundle.putString("id",id);
        startActivity(TourSignActivity.class,bundle);
    });
}
